package nowCoder;

public class Mirror {
    public void Mirror(TreeNode root) {
    	if(root==null)
    		return;
    	TreeNode tmp = root.left;
    	root.left = root.right;
    	root.right = tmp;
    	if(root.left!=null)
    		Mirror(root.left);
    	if(root.right!=null)
    		Mirror(root.right);
    }
    
    public static void main(String[] args){
    	Mirror mirror = new Mirror();
    	TreeNode root = new TreeNode("1");
    	root.left = new TreeNode("2");
    	root.right = new TreeNode("3");
    	root.left.left = new TreeNode("4");
    	root.left.right = new TreeNode("5");
    	root.right.left = new TreeNode("6");
    	
    	mirror.Mirror(root);
    	System.out.println(root.data);
    }
}
